A new approach for atmospheric turbulence removal using low-rank matrix factorization

In this article, a novel method for removing atmospheric turbulence from a sequence of turbulent images and restoring a high-quality image is presented. Turbulence is modeled using two factors: the geometric transformation of pixel locations represents the distortion, and the varying pixel brightness represents spatiotemporal varying blur. The main framework of the proposed method involves the utilization of low-rank matrix factorization, which achieves the modeling of both the geometric transformation of pixels and the spatiotemporal varying blur through an iterative process. In the proposed method, the initial step involves the selection of a subset of images using the random sample consensus method. Subsequently, estimation of the mixture of Gaussian noise parameters takes place. Following this, a window is chosen around each pixel based on the entropy of the surrounding region. Within this window, the transformation matrix is locally estimated. Lastly, by considering both the noise and the estimated geometric transformations of the selected images, an estimation of a low-rank matrix is conducted. This estimation process leads to the production of a turbulence-free image. The experimental results were obtained from both real and simulated datasets. These results demonstrated the efficacy of the proposed method in mitigating substantial geometrical distortions. Furthermore, the method showcased the ability to improve spatiotemporal varying blur and effectively restore the details present in the original image.


INTRODUCTION
Atmospheric turbulence arises as a result of temperature variations within the air.This phenomenon can be observed on hot summer days with the movement of hot air masses from an asphalt road.Moving hot air masses between cold air masses in an environment gives rise to turbulence, evident in images captured under such weather conditions.This turbulence is manifested by the simultaneous occurrence of geometric distortion and blurring.The main underlying cause of this phenomenon is the variation of the refractive subsequent list showcases some of the cutting-edge methods introduced within this domain.Li, Mersereau & Simske (2007) employed the PCA method to conduct deconvolution on multi-channel input images.This approach overlooks phase data and filters out high frequencies, potentially leading to the restoration a few local textures.Aubailly et al. (2009) introduced a localized variation of the lucky frame technique, termed the lucky region.In this method, an image quality map is initially generated for each turbulent image.These maps are constructed based on a local sharpness metric.Subsequently, in each stage, the image quality map is compared with the fused image to select the optimal local quality (lucky region).Ultimately, this selected region is merged with the corresponding region of the fused image up to this stage.A primary challenge associated with this method lies in its substantial reliance on the lighting conditions of the images.Additionally, determining the composition parameters proves to be a complex endeavor.
Lau, Lai & Lui (2019a) devised a method for swiftly generating a high-quality image, devoid of the need for image registration.They achieved this through the utilization of a variational model and an appropriate energy function.This energy function incorporates a specific term designed to quantify the level of disparity between the extracted and subsampled images.Oreifej et al. (2011) presented a two-step approach wherein the initial step involves computing the temporal average of the image sequence through an iterative procedure.In the subsequent step, the approach focuses on minimizing sparse errors, thereby effectively reducing noise, accomplished through rank minimization.
Mao & Gilles (2012) employed optical flow to estimate distortion and employed a nonlocal total variational model to mitigate blurring.Zhu & Milanfar (2012) produced a reference image by averaging a sequence of images.The non-rigid image registration was then applied individually to each image.The sequence of registered images was partitioned into overlapping patches with the local sharpness of each patch being evaluated based on its brightness variance.Subsequently, they employed temporal kernel regression to determine the ultimate selection of image patches.Ultimately, the blind deconvolution algorithm was implemented to alleviate image blur.This method had its limitations, including the reliance on the average sequence of images during the registration phase, Full-size  DOI: 10.7717/peerj-cs.1713/fig- 1 which could potentially impact accuracy.Furthermore, it lacked the capability to rectify any registration errors that might emerge in the subsequent stages of processing.Meinhardt-Llopis & Micheli (2014) initially extracted the modified parts of each pair of images using optical flow, and each part was wrapped with the mean vector of the corresponding part, yielding a new central image for every individual image.Ultimately, the resultant average image was employed as the reference image.Xu et al. (2019) used low-rank matrix factorization (LRMF) (Meng & De La Torre, 2013) for detecting a moving object in a turbulent environmental setting.Their approach involved background subtraction from the images through LRMF.Following this, employing a pipeline method (Wang, Inigo & McVey, 1990), they proceeded to identify the moving object within the residual foreground.
Lau, Lai & Lui (2019b) made a sharp reference image from a sequence of images by formulation of a pertinent energy function.Additionally, they generated a new image sequence from the same set of images by aligning regions that were nearly sharp and exhibited minimal distortion.
Subsequently, employing this novel image sequence alongside the reference image, they applied the quasiconformal map and robust principal component analysis (RPCA) to the image registration procedure.Following successful image registration, they proceeded with the task of deblurring the lower rank regions of the images, accomplished through blind deconvolution.Ultimately, through the amalgamation of these processed images, the final image was generated.Xie et al. (2016) initially generated a high-quality reference image characterized by high sharpness and minimal noise.They achieved this through the utilization of low-rank decomposition.Subsequently, they engaged in a recursive optimization process for refining the reference image, utilizing a variational model.This model encompassed both local and non-local regularization elements, which significantly aided the image registration process.In the subsequent step, they used spatial-temporal kernel regression to produce a new image characterized by minimal blur.Ultimately, in the concluding step, the final output was generated using space-invariant blind deconvolution.Lou et al. (2013) employed a combined approach involving Sobolev gradient and Laplacian methods to remove turbulence.The Sobolev gradient was employed to eliminate blurriness from the images, while the Laplacian method rectified distortions.Essentially, they curbed oscillations while enhancing image sharpness.Subsequently, they applied the lucky frame method to yield the high-quality image.Zhang et al. (2018) introduced a novel turbulence removal framework termed complex steerable pyramid (CSP).Initially, they decomposed the incoming turbulent images through CSP, and subsequently computed an averaged reference image from the decomposed phase images.Employing the disparity between the phase of the current image and that of the reference image, they endeavored to minimize distortions.Deblurring was carried out through incorporation of local energy and displacement information, alongside CSP reconstruction that merged phase and amplitude information.Eventually, the final image was obtained using blind deconvolution.Mao, Chimitt & Chan (2020) remove turbulence effects in three steps.Initially, they employ a non-local space-time averaging technique to construct a reference frame that retains moving objects.Subsequently, they generate a lucky frame using sharpness and consistency metrics.The sharpness metric identifies the sharpest patches, while the consistency metric eliminates residual jittering pixels stemming from the prior stage.Due to the presence of space-time varying blur within input frames and blurring artifacts introduced by previous processes, the ultimate step entails the utilization of blind deconvolution.Chak, Lau & Lui (2021) proposed the Wasserstein Generative Adversarial Network (WGAN) for atmospheric turbulence removal.The use of the l 1 norm as the cost function in GAN contributes to the preservation of essential textures within the restored image.A data augmentation step was incorporated as preprocessing by them to counter data scarcity.Additionally, the employment of a subsampling process resulted in enhanced and more accurate results for their proposed method.Hua et al. (2020) introduced a threestep methodology.The initial stage encompassed subsampling and reference image generation processes.Within this stage, two distinct and independent segments were employed to evaluate the degree of sharpness and geometric distortion.Subsequently, the non-rigid image registration technique was harnessed in the second stage to reduce geometric distortions.This step encompassed registering the sequences of sharply selected images from the initial stage to the reference image, achieved through estimation of deformation vectors.In the concluding stage, they sharpened the final image using the blind deconvolution method.
In the proposed method, the turbulence is modeled as In this equation, x denotes a turbulent image, while, k and j represent the pixel's position.H signifies the blurring operator, D corresponds to the geometric distortion operator, ε represents the sensor's noise, and f stands for the original image.
This article introduces a novel approach for turbulence removal within a sequence of images.
This approach effectively removes severe distortions and yields an image with prominently restored details.Unlike prior methodologies reliant on reference images and image registration for turbulence removal, this article presents a new framework that uses the concept of low-rank matrix factorization to remove turbulence.To achieve this objective, the modeling of geometric distortion and spatiotemporal varying blur is undertaken using the transformation matrix and mixture of Gaussian noise, respectively, during the computation of the low-rank matrix.Consequently, the calculation of the lowrank matrix encompasses two integral components: the estimation of blur, executed through the expectation-maximization (EM) method (Dempster, Laird & Rubin, 1977), and the estimation of distortion, accomplished via transformation matrix estimation.Within this approach, the initial step involves the adoption of the random sample consensus (RANSAC) method (Fischler & Bolles, 1981) to select a subset of optimal turbulent images from the turbulent images.Following this, parameters related to spatiotemporal varying blur, which are modeled as MOG (mixture of Gaussian) noise, are estimated through the EM method.The distortion in this method is modeled as the geometric transformation per pixel.Subsequently, in order to determine this transformation, a region is selected around each pixel.The size of this region is adaptive and is computed according to the entropy of the respective region.Based on the region's entropy.Computation of the transformation matrix for each pixel-owing to the fact that distortions on image pixels stem from a finite collection of transformations-the totality of these transformations is modeled as a mixture of Gaussian (MOG) distribution.Consequently, the mean value of each Gaussian model is adopted as the corresponding transformation for that specific pixel.Then, the transformations are applied to each pixel, and through the utilization of the low-rank matrix factorization method, the collection of resulting images is decomposed.The ultimate image sets are acquired by multiplying the two components yielded from the decomposition process.Subsequently, through averaging the final image sets, the turbulence-free image is restored.Experimental results underline the effectiveness of the proposed method in reducing distortion and spatiotemporal varying blur.So, in a nutshell, the key contributions of the proposed method can be succinctly outlined as follows: Modeling turbulence through low-rank matrix factorization as the composition of geometrical distortion and spatiotemporal varying blur.Employing RANSAC for the selection of images exhibiting analogous turbulence models.
The remainder of this article is structured as follows: The initial section provides a detailed description of the proposed method.Subsequently, the subsequent section delves into the presentation of experiments, their outcomes, and comparative analyses with alternative turbulence removal algorithms.The ultimate section provides the conclusion.Also, a list of all the variables and symbols utilized within this article is presented in Table S1.

PROPOSED METHOD
In this article, the challenge of turbulence removal is modeled as a low-rank matrix factorization problem, in which the distortion and spatiotemporal varying blur are respectively modeled as a per-pixel transformation operator denoted as τ and a mixture of Gaussian noise.By employing this model, the turbulence-free image can be restored through the dual processes of noise elimination and the estimation of geometric transformations for each pixel.This section expounds upon the comprehensive procedure of the proposed method.
The initial subsection encompasses the discussion of the low-rank matrix factorization (LRMF) technique, which constitutes the crux of the proposed method.This technique is employed to decomposed input image sets, employing both expectation-maximization (EM) and weighted alternating least squares (WALS) methods for the estimation of parameters.Subsequently, the distortion model is referred to, describing how to obtain the transformation matrix of each pixel.The following subsection explains how to use the RANSAC method to select the most suitable set of images from the input images.Ultimately, the overall process of the proposed method is expounded upon in comprehensive detail.

LRMF
Consider X ¼ x 1 ; . . .; x n ½ 2R dÂn representing a sequence of turbulent images.Here, n stands for the number of images and d signifies the dimension of each turbulent image, with each image expressed as a vector.The input dataset can be decomposed into X ¼ UV T , where U is the basis matrix and V is the coefficient matrix (Yong et al., 2017).Consequently, each element within the input matrix X can be modeled as follows: where u i and v j represent the i th and j th row vectors, respectively, of matrices U and V.The term e ij corresponds to the noise within the j th pixel of the i th turbulent image.This noise is the spatiotemporal varying blur inherent in turbulence images that is modeled as a Mixture of Gaussians (MOG).Hence, the noise can be formulated as follows: where N 0; r 2 k À Á denotes a Gaussian distribution with zero mean and r 2 variance and p k signifies the mixing proportion of the MOG.By merging Eqs. ( 2) and (3), the following relationship is established: Subsequently, by considering (Eq.( 5)) as a cost function and finding its maximum value, the estimations for the Gaussian noise parameters (Π, Σ) and the low-rank matrices U and V are determined.To find the maximum value of Eq. ( 5), the EM method is employed, as elaborated upon in the subsequent section.

Estimation of LRMF model parameters using the EM method
Equation ( 5) can be solved through the utilization of the EM method.This iterative technique computes the parameters of Eq. ( 5) in two steps: the Expectation (E) step and the Maximization (M) step.
if the e ij noise is generated by the k th Gaussian distribution.If not, it equals zero (z ijk ¼ 0).So, the probability of the partial membership of the noise of data x ij (e ij ) to the k th Gaussian model can be formulated as follows: M step 1 (updating Π, Σ): To estimate the MOG parameters, including Π and Σ, Eq. ( 5) is reformulated as follows: Recall that z ijk is equal to one if x ij is generated by the k th Gaussian model; otherwise, it is zero.Now, as shown in Eqs. ( 8) and ( 9), through maximizing the logarithm of Eq. ( 7), the parameters Π and Σ can be estimated, as presented in Eq. ( 10).
where N k ¼ P i;j c ijk .M step 2 (updating U, V): Employing the acquired estimations for the parameters Π and Σ, the values of U and V are determined through the employment of the Weighted Alternating Least Squares (WALS) method (Pan et al., 2008), which is described in the subsequent subsection.
Hence, the general procedure for estimating the low-rank matrices U and V involves the initial random initialization of the Π, Σ, and V matrices.Subsequently, by employing the EM steps and updating the U and V matrices using Eqs.( 15) and ( 16) respectively, the process continues until the convergence criterion is satisfied (Pan et al., 2008).

Weighted alternating least squares (WALS)
Consider X ¼ x 1 ; x 2 ; . . .; x n ½ 2R dÂn as the data matrix, and W ¼ w 1 ; w 2 ; . . .; w n ½ 2R dÂn as the matrix of non-negative weights.These weights are computed based on the estimated noise values for each pixel, and they are formulated as W ¼ . A higher weight w ij indicates that the data x ij has a more influence on the generation of the restored image.
As demonstrated in the aforementioned equation, a greater value of c ijk implies an increased likelihood of partial membership of the data x ij within the k th Gaussian model.Consequently, the weight assigned to this data also rises.The weighted low-rank matrix approximation of matrix X is computed by minimizing the subsequent function: where jj:jj 2 F signifies the Frobenius norm and represents the Hadamard product.Let's assume that the matrix Y, comprising turbulence-free images, can be decomposed into two lower-rank U and V matrices (r ( min n; d ð Þ): Y ¼ UV T .Consequently, Eq. ( 11) can be reformulated as follows: To avoid overfitting, by adding new terms, Eq. ( 12) becomes the following: Here, λ represent regularization parameter.By assuming V as a constant and solving the equation 1 2 , the estimation of U is accomplished, as illustrated in Eq. ( 15): Here diag w i ð Þ 2 R nÂn denotes a diagonal matrix with elements w i and I represents an identity matrix with dimensions r Â r.
By performing the same procedure, the value of V can also be calculated as follows: Algorithm 1 outlines the pseudo-code for parameter estimation using the LRMF method.
Since the count of Gaussian models has a significant impact on both the convergence speed and the accuracy of the algorithm, the determination of the count for these models was conducted in an adaptive manner.
As stated in Meng & De La Torre (2013), the process commences with the initialization of the count of Gaussian models, set at a value suitable for modeling the noise distribution (denoted as Max k ).Subsequent to each iteration of the EM algorithm, the distance between each pair of Gaussian distributions is computed employing the Kullback-Leibler (KL) divergence technique.If the distance between the two Gaussian models falls below the preestablished threshold, these models are regarded as similar, prompting their amalgamation.Given that the mean value of the Gaussian distributions utilized for noise modeling is consistently taken as zero, the amalgamation of Gaussian models necessitates the computation solely of the standard deviation and the mixing proportion for the resultant hybrid Gaussian model.

Distortion model
Alongside inducing spatiotemporal varying blur, turbulence also introduces image distortion.Distortion encompasses abrupt shifts in the signal that lead to its degradation.Distortions in turbulent images emerge when the pixel displacement within the local vicinity can be modeled as a geometric transformation.Determining the optimal alignment for each pixel reduces distortion and strives to minimize the rank of the transformed image.With regard to the transformed image, the optimization equation for LRMF is presented as follows: As x s involves a nonlinear operation, it is very difficult to optimize it within the same formulation.However, considering the slight changes in τ, by linearizing (Eq.( 17)), the iterative estimation of τ becomes feasible, as delineated in Eq. (18).
where J i represents the Jacobian matrix corresponding to the i th image with respect to the transformation parameters s i : < e for some i; j; then combine i th ; j th gaussian component into a unique gaussian by letting The Robust Alignment by Sparse and Low-rank decomposition (RASL) method (Peng et al., 2012) has demonstrated the robustness of this approximation in cases of linearly correlated images, even in the presence of drastic variations in brightness and occlusion.Considering Eq. ( 19), the modification of the optimization function (Eq.( 17)) for the i th image transpires as follows: where V i ; and W i denote the i th columns of matrices V and W, respectively, pertaining to the i th image (x i ).With the known values of U and V, the cost function is established in Eq. ( 21) to estimate the transformation matrix: As Eq. ( 21) is a variation of the least absolute deviation problem, it can be effectively solved using the Alternating Direction Method of Multipliers (ADMM) method (Boyd, Parikh & Chu, 2011).
Subsequently, by formulating the Lagrangian function as Eq. ( 22) and incorporating the input values of U; V i ; t i ; and J i , the optimal value of Ds Pþ1 is computed utilizing the ADMM approach by Eq. ( 23): where where e Pþ1 ¼ S 1 and l Pþ1 ¼ ql P .In these equations, S 1 l P stands for the elementwise soft thresholding operator (as described in Boyd, Boyd & Vandenberghe (2004)).Here, q > 1 signifies the penalty value that increases the μ value in the ascending order, and P denotes the step within the ADMM algorithm.The overall procedure of this estimation is depicted in Algorithm 2.
As previously mentioned, the task entails determining the locally optimal transformation matrix for every pixel.Thus, for each image pixel, a 3 × 3 transformation matrix needs to be identified to effectively model the distortions.Rather than focusing on the transformation of individual pixels, it is feasible to model the transformation of a window encompassing the pixel at its center.After the application of the transformation matrix to each window, the value of each transformed pixel (x i t i ) within the i th image corresponds to the median value across all windows containing that pixel.
To achieve this goal, the sliding windows approach is employed.The dimensions of each window is adaptive depending on the entropy of the window.Initially, the window's size is set to the minimum size W min and it expands until its entropy becomes lower than a percent (0 < a < 1) of the image's entropy.The maximum size allowed for windows is W max .W min ; W max and a constitute the free parameters of the proposed method.Since higher entropy in the image indicates more intricate details, lower entropy (signifying image smoothness) results in greater uncertainty when calculating the transformation matrix.Thus, if the window's size is expanded to the maximum permissible extent without surpassing α percent of the overall image entropy, the calculation of the transformation matrix for that window is skipped.Instead, its value is approximated using the transformation matrix from neighboring windows.Despite distortion implying abrupt shifts in pixel positions, these changes cannot be very drastic.Consequently, a mechanism must be considered for removing transformation matrices that yield substantial pixel displacements.To address this, the mean and variance of all estimated Ds i matrices are calculated.Those matrices exceeding a threshold of β percent, in terms of their distance from the mean value, relative to the total variance, are designated as outliers.Subsequently, pixels with the Ds i matrix that are identified as outliers (pixels with a window size equal to W max and those with a Ds i matrix with a drastic value) are assigned the mean value of Ds i matrices from neighboring pixels.Ultimately, the transformation matrix for each window is determined by accumulating the estimated Ds i values from different iterations.(s Given that the distortion affecting pixels arises from a limited range of distinct transformations, a MOG model is computed using the estimated transformation matrices.This MOG model serves as a representation of all the distortions affecting image pixels.Employing the computed MOG, the final transformation matrix for each window is Algorithm 2 ADMM for estimate Ds. established as the mean value of the Gaussian model, with the transformation matrix of that window being a member of said Gaussian model.As a reminder, similar to the adaptive determination of the number of Gaussian models for noise (as outlined in Algorithm 1), the number of Gaussian models for distortions is also computed adaptively using the same approach.The comprehensive process of distortion removal is presented in Algorithm 3.
Selecting a subset of images using the RANdom SAmple Consensus (RANSAC) method Turbulent images can exhibit varying degrees of distortion and blurring due to different conditions and intensities.Consequently, identifying and excluding images that exhibit distinct turbulence patterns can lead to improved outcomes.The RANSAC method is employed within the proposed approach to achieve this objective (refer to Algorithm 4).To accomplish this, a subset of m images m ( n ð Þ) is randomly selected, and the proposed method (as described in Algorithm 5) is applied to this subset, yielding a restored image (denoted as r1).Subsequently, each of the remaining images is processed using Algorithm 5 along with the initial set of m images.This leads to the generation of an output matrix R ¼ UV T ; containing m þ 1 images.Instead of averaging the images, the Þ th image is selected as the final image for the process.By utilizing cross-correlation, the similarity between the restored image (r1) and the Similarly, the distances between two noise distributions of the m images and the m þ 1 images and two transformation matrix distributions s ð Þ of the m images and the m þ 1 images are computed using the Kullback-Leibler (KL) divergence.These are respectively termed C2 and C3.
If the weighted average of these three criteria (C1, C2, and C3) falls below a predetermined threshold, this image is regarded as a member of the support set of the initial m images.The procedure for calculating the KL divergence between two MOG distributions is elaborated in Appendix A.
This process is iterated multiple times, and in the end, the m images with the largest support set are selected.The selected m images and their associated support set are combined to create the new subset.The final restored image is obtained by applying the proposed method to this refined subset.In this process, the excluded images are the ones that have different turbulence characteristics compared to the others.It is important to note that the excluded images may not necessarily have lower turbulence than those that were not selected.Nonetheless, due to the fact that the selected images have the same conditions compared to each other, empirical evidence indicates that the proposed method efficiently estimates the blur and distortion characteristics within this subset, leading to an improved output.

Overall procedure
As stated, the turbulence present in the images is modeled as being influenced by two distinct factors: distortion, characterized by geometric transformations that alter pixel positions, and spatiotemporal varying blur, which leads to variations in pixel brightness values.
Taking into account the methodologies discussed in the LRMF and distortion model sections, the comprehensive procedure of the proposed approach for removing turbulence in a collection of images captured from a single scene can be outlined as follows: To begin, employ the RANSAC method as detailed in the selecting a subset of images using the RANSAC method section to identify the most suitable subset of input images.Then calculate the R matrix using optimization described by Eq. ( 17), which is the main optimization function of the proposed method, where R ¼ UV T is the set of final images.Since the proposed procedure effectively eliminates turbulence, the R matrix includes n images by minimal turbulence.Consequently, a straightforward averaging of these n images yields the turbulence-free image (reference image).The estimation of both the U and V matrices entails an iterative methodology based on the process elucidated in the LRMF section.Nonetheless, due to the inherently nonlinear character of calculating the Algorithm 3 Removing distortion from image.input: x; U; V; s extract subregion of image x using sliding windows based on the entropy of each pixel as f j ; j ¼ 1; . . .; d for each f j : if f j satisfy entropy carcumestion calculate Ds j using Algorithm 2 else set Ds j as outlier end if end for using variance and average of all Ds j to detect outlier ones for each f j : if Ds j is outlier calculate Ds j using Ds matrix of neighboring windows end if end for s j ¼ s j þ Ds j estimate MOG using s j and assign mean of MOG models to each windows for each pixel index j in x L = set of all j th pixel exist in all transformed windows j th pixel of x s = median(L) end for return x s x s transformation, as expounded in the distortion model section, the transformation is executed iteratively by estimating Δτ values.Consequently, to integrate these two iterative procedures, the previously outlined steps are executed concurrently.At the initiation of the procedure, all pixel transformation matrices are initially set as identity matrices (8i s i ¼ I).Subsequently, the algorithm commences with an iteration of Algorithm 1 (as detailed in the LRMF section) to estimate the values of V k and U k (with k representing the current iteration step of the algorithm).To achieve this, the initial step involves estimating the parameters of the MOG.Following this, the weights needed for the WALS method are calculated based on these parameters.Subsequently, utilizing the calculated Algorithm 4 RANSAC method to best subset image selection.
input: X ¼ ½x 1 ; x 2 ; . . .; x n Initialization: r1 as restored image by averaging on m restored images, r2 as ðm þ 1Þ th restored image for k = 1:C select m i images randomly for l ¼ 1:n À m calculate r1: apply Algorithm 5 on m i images calculate r2: apply Algorithm 5 on m i images in addition to each remaining image fg j ¼ 1; . . .; n À mg calculate C1 j : calculate similarity of r1 and r2 images using cross correlation calculate C2 j : calculate noise distribution distance of m and m + 1 image sets using KL divergence calculate C3 j : calculate transformation distribution distance of m and m + 1 image sets using KL divergence add g i image to support set of m i images if weighted average of C1 j ; C2 j ; C3 j is less than predefined threshold end for end for select fm i ¼ 1; . . .; Cg that have largest support set as m * and related support set as s * return fm Ã þ s Ã g Algorithm 5 Calculating low rank matrix using LRMF method.input: X ¼ ½x 1 ; x 2 ; . . .; x n initilization : 2024), PeerJ Comput.Sci., DOI 10.7717/peerj-cs.1713 V k and U k values obtained through the WALS method (as described in the LRMF section), the second step is executed.This involves computing Δτ for all images in accordance with Algorithm 2 (elaborated upon in the distortion model section), and subsequently generating x i s k i (the transformed image in the k th step).The algorithm's detailed steps are presented in Algorithm 3.After this, the previously described procedure is repeated, and the U and V matrices are updated using the calculated x i s k i values.This iterative process continues until the predetermined stopping condition is met.The complete procedure is visually depicted in Fig. 2. The main part of the proposed method is the calculation of the low rank matrix, which is shown by the green box in the mentioned figure .A detailed algorithmic representation of this part is provided in Algorithm 5.

Datasets
The evaluation of the proposed method encompasses both simulated and real datasets.The real datasets consist of the Chimney, Building, Moon-surface, and Water-tower sets, each of which includes corresponding ground truth images (Zhu & Milanfar, 2012).Meanwhile, the simulated datasets encompass the Car-front (Lau, Lai & Lui, 2019a) and Road (Lau, Lai & Lui, 2019a) sets.The simulated dataset is generated using two distinct approaches.The first method involves warping through a Gaussian deformation vector and introducing blurring through Gaussian noise.This dataset is referred to as the Gaussian simulated dataset.The second approach employs inter-modal and spatially correlated Zernike coefficients (Chimitt & Chan, 2020).This dataset is referred to as the Zernike simulated dataset.Further comprehensive information about these datasets is available in Appendix B.
The value of SSIM is in the range of [0, 1] and equals one if the two images are exactly equal.

Free parameters and implementation details
The proposed method involves thirteen free parameters, which can be fine-tuned by experts and users who utilize the method.The specific values of these parameters, employed in all experiments within this section, are presented in Table 1.The free parameters can be classified into six distinct groups.The first group encompasses the convergence criteria of the EM method.This parameter involves a trade-off between runtime and algorithm accuracy.Given that turbulence removal is not a real-time computation but rather an offline problem, the chosen value strikes a balance between achieving satisfactory accuracy and ensuring a reasonable runtime.The intention is to avoid an excessively stringent threshold that could lead to impractical computation times while still maintaining attainable levels of accuracy.The second group of parameters pertains to the calculation of Ds matrices and includes a, W min ; and W max ;, which are utilized in determining the size of the sliding window.Additionally, β is employed to identify outlier Δτ.These parameter values were chosen through a process of trial and error, involving thorough examination of the datasets.It is important to note that the value of W min should be chosen small enough to encompass local transformation information, while W max should not be too large, as it might include a substantial portion of the image, causing the estimated transformation to become out of locality.The third group of free parameters is used to determine the optimal value of Δτ through the ADMM method.This group comprises parameters q and e tolerance with their values set to the ones according to the recommendations of He et al. (2014).The fourth group of free parameters pertains to the number of MOG models used in noise and distortion estimation.This group encompasses the maximum number of models and the threshold for model integration, determined through a trial-and-error process.When selecting the value of the integration threshold, ensure that it is not too small, which would preserve similar models, and not excessively large, as it might lead to the merging of dissimilar models.The fifth group of free parameters encompasses the RANSAC parameters: the parameter m represents the minimum number of images required for the algorithm to function accurately.Through the examination of the datasets, it has been determined that the proposed method can effectively remove turbulence with a set of 25 images.Therefore, the parameter m has been set to 25.Within this group, a threshold value is defined for the purpose of identifying the support set.If the weighted mean of the three criteria introduced in selecting a subset of images using the RANSAC method section becomes lower than this threshold, the current image is regarded as a member of the support set of the initial set of m images.The value of this threshold is also determined through trial and error.The stopping criteria for the EM method (Algorithm 1), RANSAC method (Algorithm 4), and calculating low rank matrix (Algorithm 5) are the number of iterations, which are set to 40, 10, and 100 iterations, respectively.The sixth group of free parameters involves the λ parameter applied in the WALS method.The determination of this parameter value was achieved through an iterative process of trial and error, conducted specifically on the applied datasets.

Compare the results of the proposed method with the existing methods
As mentioned, the results of the proposed method are compared with the results of the other eleven methods.The results of the Gaussian simulated dataset are compared with the Two-Stage, NDL, SGL, Centroid, RPCA, and JSUB methods, and the results of the Chimney and Building image sequences are compared with the PCA-Based, Lucky Region, Two-Stage, BNLTV, NDL, HVDKR, SGL, Centroid, and UCSPF methods.These comparative results are presented in Tables 2 and 3, respectively.The results of the proposed method on the sequences of the Moon-surface and Water-tower images are provided in Appendix C. As none of the previous methods reported results on these two sequences and their code was unavailable, only the results of the proposed method are  presented for these datasets.Similarly, Table 4 contains results only for the Zernike simulated dataset.According to the results presented in Tables 2 and 3, it can be observed that the proposed method outperformed the previous methods in terms of the SSIM criterion for all datasets.However, in terms of the PSNR criterion, the proposed method exhibited lower performance compared to the previous methods for the Road and Chimney datasets.Figures 3-6 provide visual representations of the restored images obtained from the proposed method and the results of the previous methods.It is evident from these images that the Centroid, RPCA, JSUB, Two-Stage, NDL, HVDKR, and UCSPF methods yield higher visual quality in terms of the final restored image compared to the other methods.
The Centroid method exhibits a restored image with lower quality compared to other methods.Despite the restoration of the geometric structure, the resulting image appears blurry and overly brightened due to the effects of temporal averaging.
The RPCA method, lacking a mechanism to effectively remove distortion, primarily focuses on selecting a subset of turbulent images with minimal distortion and maximal sharpness during the subsampling stage.As a result, the restored image obtained using the RPCA method continues to exhibit some degree of distortion.Nonetheless, due to its emphasis on the selection of a subset of sharp images and using the appropriate energy function to merge these subsampled images, coupled with the application of the blind deconvolution method, the restored image has little blur.
The JSUB method closely resembles the RPCA method except that its energy function uses TV regularization, the L 2 norm, and adaptive Gaussian noise for joint subsampling.This method also lacks a blind deconvolution step, resulting in a mildly distorted but blurred image.
The Two-Stage method's deficiency caused by from the generation of an unsuitable reference image through the averaging process, leading to errors during the registration stage and ultimately resulting in a blurred final image.
Similar to the Two-Stage method, the NDL method also suffers from the impact of the erroneous reference image generated through the averaging process.This issue substantially affects the performance of the registration stage, and even though the method employs the blind deconvolution technique, the resulting image lacks clarity in terms of capturing image details.HVDKR uses the RPCA method to generate a reference image with reduced blur and distortion.This approach then further enhances the reference image using a variational model.Employing deformation-guided fusion the method not only models and mitigates the impact of the image but also effectively reduces blurriness in the final restored image.But since it is a step-by-step process, the interaction between the two factors of blur and distortion has not been taken into account.As a result, while the output images may exhibit relatively improved sharpness, the overall restored image tends to retain some level of blurriness and distortion, and also the fine details in the image are not well-defined.
In the UCSPF method, by separating the phase and magnitude components in the frequency domain, structural information and brightness intensity are separated to process the two distortion and blur factors separately.Through multiscale and multidimensional operations applied to these distinct components, the UCSPF method effectively produces an output image characterized by reduced levels of distortion and blur.Moreover, this approach facilitates the preservation of sufficient image details.Nonetheless, the processing conducted in the frequency domain lacks access to spatial information.For this reason, frequency-domain processing, although well-restored in detail in high-energy areas, has caused fluctuations in the brightness intensity in smooth regions.Despite the As evident in Figs.3-6, the resulting images from the proposed method exhibit sharper edges and finer details in comparison to those generated by other methods.The smooth regions within the ground truth images are returned as smoothly in the output images.The distortion is removed as much as possible, but the brightness of the output image in the Chimney sequence produced by the proposed method appears slightly darker compared to the corresponding ground truth image.Figure 7 presents the restored images generated by the proposed method on the Zernike turbulence dataset.A visual comparison of both Gaussian and Zernike turbulence images reveals that blurring is more obvious than distortion in the Zernike images.While the proposed method effectively restores Zernike turbulence images with notable accuracy, as evident in Fig. 7F, it is worth noting that the details of the asphalt road are not fully restored to their original quality.
Indeed, conventional images typically exhibit characteristics of low-frequency signals, rendering them low rank.Distortion, characterized by sudden change in the signal changes, introduces high-frequency components that elevate the signal's rank.
The time-varying blur in an image sequence from a single scene results in images that are distinct from one another.Consequently, the overall diversity of the image sequence increases.This phenomenon elevates their temporal rank.Turbulence images, caused by both distortion and spatiotemporal varying blur, possess high ranks.Consequently, by generating a low-rank matrix, it becomes possible to obtain an image that encompasses all high-rank images derived from it.This image aims to closely resemble the reference (turbulence-free) image.Consequently, the creation of a low-rank matrix can be used to eliminate turbulence.Accordingly, the LRMF method was adopted for this particular objective.Through the iterative integration of these two techniques within the LRMF method, a comprehensive framework has been established.This framework is capable of generating turbulence-free images while minimizing the presence of turbulence.The performance of the proposed method was assessed in terms of the PSNR and SSIM criteria using the t-test statistical method.To accomplish this, the maximum values obtained from the previous methods were compared with those of the proposed method.The outcome of the PSNR-based t-test indicated a 50% similarity, signifying that the proposed method's accuracy is on par with the best outcomes of the previous methods.Conversely, the t-test conducted based on the SSIM yielded a result of 95%, underscoring the superior accuracy of the proposed method in comparison to the preceding previous methods.Since the PSNR criterion is based on MSE, even slight changes in the image's brightness can lead to a decrease in the numerical values of this criterion.Therefore, the relative darkening observed in the results of the proposed method might contribute to the decrease in the numerical values of this criterion.On the other hand, SSIM is a perception-based criterion that, like the human visual system, considers structural, luminance, and contrast similarities between the two images.Therefore, higher numerical values of this criterion in the results of the proposed method indicate a high perceptual similarity between the resultant images and the reference images.Further detailed evaluation of the proposed method is provided in Appendix D.

CONCLUSION
In this article, a new method is proposed to remove turbulence effects in a sequence of images that simultaneously eliminates distortion and spatiotemporal varying blur.The approach involves modeling blur using a mixture of Gaussian (MOG) noise representation, while distortion is modeled as local geometric transformation matrices.
Given that turbulence introduces high-rank characteristics to input images, we employ the low-rank matrix factorization (LRMF) technique to generate low-rank images with minimal turbulence.To address this, we introduce a novel framework that integrates two models, namely MOG noise and transformation matrices, into the LRMF method to effectively eliminate turbulence.Furthermore, accurate MOG parameter estimation and transformation matrix estimation are achievable for images with similar turbulence characteristics, we have leveraged the RANSAC method to identify and exclude images with distinct turbulence models.Our evaluation, conducted on both real and simulated datasets, consistently demonstrates that the proposed method outperforms its predecessors.This method does have its limitations, including relatively slower processing speed compared to certain previous methods, as well as instances where the resulting images may appear darker than the reference image.While the proposed method demonstrates a degree of robustness to variations in its free parameters, the experiments conducted across diverse datasets indicate that the values suggested in this article generally lead to satisfactory accuracy in the output.However, if these free parameters were finetuned based on the images used, better results could be achieved.

FUTURE WORK
Indeed, the proposed method encompasses numerous free parameters that require expert regulation.While these parameters might not significantly impact the method's performance and processing speed, the intention behind offering adjustable parameters is to allow practitioners to tailor them according to specific image conditions.This adaptability ensures that other developers can readily apply the method to their own applications with ease.Enhancing the speed of the proposed method is feasible by incorporating a frequency-domain distortion modeling approach.This strategy involves introducing an appropriate term during the noise removal process, thereby generating an image that more closely aligns with the ground truth in terms of brightness.This frequency-domain distortion modeling technique holds potential for improving both the computational efficiency and the quality of the final output image.One of the authors' future plans involves extending this method to address turbulence removal in dynamic environments that include moving objects.This expansion would center around refining the estimation of the transformation matrix model to account for changes caused by the presence of moving objects within the scene.

Figure 7 (
Figure 7 (A) The reference image of the car-front sequence (B) one Zernike simulated image, and (C) the qualitative results of the proposed method, (D) the reference image of the road sequence (E) one Zernike simulated image (F) the qualitative results of the proposed method.Photo credit: Pui Anantrasirichai.Full-size  DOI: 10.7717/peerj-cs.1713/fig-7

Table 1
Free parameters of the proposed method and their values, which have been used in all experiments.

Table 2
The results of the proposed method and other existing methods based on PSNR (first rows) and SSIM (second rows) criteria on Gaussian simulated datasets.

Table 3
The results of the proposed method and other existing methods based on PSNR (first rows) and SSIM (second rows) criteria on the chimney and building sequences.

Table 4
The results of the proposed method based on PSNR (first rows) and SSIM (second rows) criteria on Zernike simulated datasets.